package com.libinyn.base.service.impl.common;



import com.libinyn.base.service.common.ICommonService;
import com.libinyn.base.utils.MyMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * 通用service实现
 * @fileName: BaseServiceImpl.java
 * @author: bin.li01
 * @date: 2017/10/18 21:08 
 * @version: v1.0.0
 */
public abstract class CommonServiceImpl<T> implements ICommonService<T> {


    @Autowired
    protected MyMapper<T> myMapper;

    public MyMapper<T> getMyMapper() {
        return myMapper;
    }

    @Override
    public List<T> select(T record) throws Exception {
        return myMapper.select(record);
    }

    @Override
    public T selectByPrimaryKey(Object key) throws Exception {
        return myMapper.selectByPrimaryKey(key);
    }

    @Override
    public List<T> selectAll() throws Exception {
        return myMapper.selectAll();
    }

    @Override
    public T selectOne(T record) throws Exception {
        return myMapper.selectOne(record);
    }

    @Override
    public int selectCount(T record) throws Exception {
        return myMapper.selectCount(record);
    }

    @Override
    public int insert(T record) throws Exception {
        return myMapper.insert(record);
    }

    @Override
    public int insertSelective(T record) throws Exception {
        return myMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKey(T record) throws Exception {
        return myMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateByPrimaryKeySelective(T record) throws Exception {
        return myMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int delete(T record) throws Exception {
        return myMapper.delete(record);
    }

    @Override
    public int deleteByPrimaryKey(Object key) throws Exception {
        return myMapper.deleteByPrimaryKey(key);
    }

    @Override
    public List<T> selectByCondition(Object condition) throws Exception {
        return myMapper.selectByCondition(condition);
    }

    @Override
    public int selectCountByCondition(Object condition) throws Exception {
        return myMapper.selectCountByCondition(condition);
    }

    @Override
    public int updateByCondition(T record, Object condition) throws Exception {
        return myMapper.updateByCondition(record,condition);
    }

    @Override
    public int updateByConditionSelective(T record, Object condition) throws Exception {
        return myMapper.updateByConditionSelective(record,condition);
    }

    @Override
    public int deleteByCondition(Object condition) throws Exception {
        return myMapper.deleteByCondition(condition);
    }

    @Override
    public int insertList(List<T> recordList) throws Exception {
        return myMapper.insertList(recordList);
    }

    @Override
    public List<T> selectByIds(String ids) throws Exception {
        return myMapper.selectByIds(ids);
    }

    @Override
    public int deleteByIds(String ids) throws Exception {
        return myMapper.deleteByIds(ids);
    }

}
